home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / UNIXLIB37B / !UnixLib37 / src / clib / sys / h / syslib < prev    next >
Text File  |  1996-11-09  |  6KB  |  187 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /unixb/home/unixlib/source/unixlib37/src/clib/sys/h/RCS/syslib,v $
  4.  * $Date: 1996/11/06 22:01:41 $
  5.  * $Revision: 1.5 $
  6.  * $State: Rel $
  7.  * $Author: unixlib $
  8.  *
  9.  * $Log: syslib,v $
  10.  * Revision 1.5  1996/11/06 22:01:41  unixlib
  11.  * Yet more changes by NB, PB and SC.
  12.  *
  13.  * Revision 1.4  1996/10/30 21:58:59  unixlib
  14.  * Massive changes made by Nick Burret and Peter Burwood.
  15.  *
  16.  * Revision 1.3  1996/07/21 22:15:12  unixlib
  17.  * CL_0001 Nick Burret
  18.  * Improve memory handling. Remove C++ library incompatibilities.
  19.  * Improve file stat routines.
  20.  *
  21.  * Revision 1.2  1996/05/06 09:03:13  unixlib
  22.  * Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
  23.  * Saved for 3.7a release.
  24.  *
  25.  * Revision 1.1  1996/04/19 21:23:56  simon
  26.  * Initial revision
  27.  *
  28.  ***************************************************************************/
  29.  
  30. #ifndef __SYS_SYSLIB_H
  31. #define __SYS_SYSLIB_H
  32.  
  33. #ifndef __SYS_OS_H
  34. #include <sys/os.h>
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. /* Keep in sync with clib.unixlib.s.asm_dec */
  42. #define __ALLOCA_FATAL
  43. #undef __PARANOID
  44. #define __DYNAMIC_AREA
  45. #undef __4K_BOUNDARY
  46.  
  47. extern int __funcall_error(char *, int, unsigned int);
  48. #ifndef __PARANOID
  49. #define __funcall(f,p) ((f)p)
  50. #else
  51. #define __funcall(f,p) \
  52.   ((((void *)(f) >= __base) && (((unsigned int)(f) & ~3) == (unsigned int)(f)) \
  53.    ? 0 : __funcall_error(__FILE__,__LINE__,(unsigned int)(f))), (f)p)
  54. #endif
  55.  
  56. extern void __main(void);    /* assembler initialization */
  57. extern void _main(void);    /* C initialization */
  58.  
  59. extern void __exit(int);    /* assembler exit */
  60. extern void __exit_no_code(void);
  61.  
  62. #define STAKSIZ 2048
  63.  
  64. /* __break is initialised to __lomem & __stack to __himem - STAKSIZ;
  65.  * __stack is extended downwards in 512 byte chunks by x$stack_overflow()
  66.  * and __break is extended upwards by brk() and sbrk(). The sl
  67.  * register is kept equal to __stack + 256. Should x$stack_overflow()
  68.  * attempt to extend __stack below __break then SIGEMT is raised.
  69.  * Should brk() or sbrk() be asked to extend __break above __stack
  70.  * then they return with ENOMEM. */
  71.  
  72. extern char *__cli;        /* command line from OS_GetEnv */
  73.  
  74. extern void __svccli(char *);    /* strcpy __cli in SVC mode */
  75.  
  76. extern void *__base;        /* BASE = Image$$RO$$Base */
  77. extern void *__lomem;        /* LOMEM = Image$$RW$$Limit */
  78. extern void *__himem;        /* HIMEM from OS_GetEnv */
  79. extern void *__rwlimit;
  80.  
  81. extern void *__break;        /* end of data area */
  82. extern void *__stack;        /* bottom of stack */
  83. extern void *__stack_limit;
  84. extern int __codeshift;
  85. extern int __dynamic_num;
  86. extern void __dynamic_area_exit(void);
  87.  
  88. /* Zero if we are not executing within a TaskWindow
  89.    Not zero if we are executing within a TaskWindow.  */
  90. extern int __taskwindow;
  91.  
  92. extern unsigned int __time[2];    /* start time */
  93.  
  94. #define __OS_ARTHUR    0xA0
  95. #define __OS_RISCOS_200 0xA1
  96. #define __OS_RISCOS_201 0xA2
  97. #define __OS_RISCOS_300 0xA3
  98. #define __OS_RISCOS_310 0xA4
  99. #define __OS_RISCOS_350    0xA5
  100. #define    __OS_RISCOS_360 0xA6
  101. #define __OS_RISCOS_370 0xA7
  102.  
  103. /* setjmp() and longjmp() modify their behaviour according to __fpflag */
  104.  
  105. /* FP flag reflecting Floating Point presence or not.  */
  106. extern int __fpflag;
  107.  
  108. /* Check Floating Point presence and set/clear __fpflag to suit.  */
  109. extern void __fptest(void);
  110.  
  111. /* Resource limit initialisation */
  112. extern void __resource_initialise (void);
  113.  
  114. /* Initialse the signal handlers.  */
  115. extern void __unixlib_signal_initialise (void);
  116.  
  117. /* Stop the interval timers.  */
  118. extern void __stop_itimers (void);
  119.  
  120. /* OS_ChangeEnvironment is used to set up exception handlers. These
  121.  * handlers use OS_CallBack to raise signals in the foreground process.
  122.  * RTFM (RiscOS PRM - 'The Program Environment') for more info. */
  123.  
  124. /* __reset() performs all the functions of exit(), but returns without
  125.  * exiting - note that after a call to __reset() all handlers are
  126.  * in their original state, and *all* stdio & UNIX I/O has been shut down.
  127.  * You should use __exit() to exit after __reset(). */
  128.  
  129. extern void __reset(void);    /* reset handlers, etc. back to orig. state */
  130.  
  131.  
  132. /* struct handler contains all the information about an
  133.  * OS_ChangeEnvironment handler */
  134.  
  135. struct handler
  136.   {
  137.   void            (*h)(void);    /* address of handler (0 = default) */
  138.   unsigned int        r;        /* r12/0 handler arg. (0 = default) */
  139.   void            *b;        /* buffer pointer (0 = default) */
  140.   };
  141.  
  142. /* struct env contains all the info. needed to restore
  143.  * the RiscOS environment prior to a call to OS_Exit */
  144.  
  145. struct env
  146.   {
  147.   struct handler    h[13];        /* handlers 0-12 */
  148.   };
  149.  
  150. extern struct env __Cenv[1];        /* this C environment */
  151. extern struct env __Oenv[1];        /* the old (calling) environment */
  152.  
  153. extern _kernel_oserror *__rdenv(int,struct handler *); /* OS_ChangeEnvironment */
  154. extern _kernel_oserror *__wrenv(int,struct handler *); /* OS_ChangeEnvironment */
  155.  
  156. /* vfork() & exec() */
  157.  
  158. extern void __vret(int);    /* return from child - calls __vexit() */
  159.  
  160. extern int *__vfork(void);    /* fork to child context */
  161. extern int *__vexit(int);    /* restore to parent context */
  162.  
  163. extern void __exret(void);    /* return from __exec() - calls __vret() */
  164.  
  165. extern void (*__exptr)(char *); /* pointer to __exec() routine */
  166. extern int __exlen;        /* length of __exec() routine */
  167. extern _kernel_oserror *__exerr;
  168. extern int __exshift;        /* __exec() shift */
  169.  
  170. /* vfork weak link */
  171.  
  172. extern void (*___vret)(int);
  173.  
  174. /* stdio weak links */
  175.  
  176. extern void (*___stdioinit)(void);
  177. extern void (*___stdioexit)(void);
  178.  
  179. /* C++ global constructor weak link */
  180. extern void (*___do_global_ctors)(void);
  181.  
  182. #ifdef __cplusplus
  183.     }
  184. #endif
  185.  
  186. #endif
  187.